<!DOCTYPE html>
<meta charset="UTF-8">
<div th:if="${model.size() != 0}">
<table class="table table-hover" style="width: 100%">
	<tr>
		<td>编号</td>
		<td>书名</td>
		<td>作者</td>
		<td>借书时间</td>
		<td>还书时间</td>
		<td>状态</td>
		<td>操作</td>
	</tr>
	<tr th:each="m:${model}">
		<td th:text="${m.byid}"></td>
		<td th:text="${m.title}"></td>
		<td th:text="${m.suthor}"></td>
		<td th:text="${m.borrowData}"></td>
		<td th:text="${m.returnData}"></td>
		<td th:text="${m.state}"></td>
		<td th:if="${m.state}=='已借'">
			<a th:onclick="'javascript:returnbook(\''+${m.id}+'\')'" style="cursor: pointer;">还书</a>
		</td>
	</tr>
</table>
</div>
<div th:if="${model.size() == 0}">
没有借过书哦，快去借一本赏识一下吧
</div>
<script>
	function returnbook(id){
		layui.use('layer', function(){
		var layer = layui.layer;
		  layer.confirm('确定还书吗？', function() {
			  $.post('userbook/returnbook',{id:id},function(result){
				  $("#body1").load("userbook/borrow");
				  layer.msg(result);
			  })
			  });
		  });
	}
</script>